from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import set_cutscene, get_game

class restroom2(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        
        # build list of actions
        self.add_action(MakeYourMove)
        self.add_action(UseHead)
    
    # return description of room.
    def get_description(self):
        return "While waiting for the Men's Rooms, a hot bridesmaid sits on the bench next to you and starts removing her peep-toe heels. You make intense eye contact. She says, 'My feet are so sore... Ahh, that feels better. You're a great dancer!' Now you have a choice to make. Do you flirt with the hot bridesmaid, or do you enter the men's bathroom that just became vacant?"
    
    # return image of room
    def get_image(self):
        return 'restroom.jpg'


class Restroom2Handler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return restroom2

# define actions for this room

class MakeYourMove(Action):
    def __init__(self):
        Action.__init__(self, "makeyourmove")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Hit on the Bridesmaid"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        game = get_game()
        if ((game.get_drinks() >=3) and (game.get_drinks() <=5) and (game.get_food() >= 5) and (game.get_social() >=3)):
            return "victory_room"
        else:
            return "loserroom"
    
    def do_action(self,game,room,request):
        if ((game.get_drinks() >=3) and (game.get_drinks() <=5) and (game.get_food() >= 5) and (game.get_social() >=3)):
            set_cutscene("For some reason, she bought it.")
        else:
            if (game.get_drinks() < 3):
                drinks_feedback = "Try building up your swagger with some more drinks."
            elif (game.get_drinks() >5 ):
                drinks_feedback = "You drank too much. Sloppy!"
            else:
                drinks_feedback = "You were pleasantly buzzed."
            
            if (game.get_food() < 5):
                food_feedback = "Eat more crab cakes!"   
            else:
                food_feedback = "You ate enough crab cakes."
            
            if (game.get_social() < 3):
                social_feedback = "Don't be so lame-talk to some people!"
            else:
                social_feedback = "You talked to enough people."
                
            set_cutscene("Woah! Bad move!" + " " + drinks_feedback + " " + food_feedback + " " + social_feedback)
        return
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"

class UseHead(Action):
    def __init__(self):
        Action.__init__(self, "UseHead")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Take a quick #1 and get back on the Dance Floor!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'dancefloor'
    
    # set cutscene
    def do_action(self,game,room,request):
        game.drinks -= 1
        set_cutscene("After using the restroom you feel about a drink lighter.")
        return
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"
